package com.guigu.www.luolujin.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.guigu.www.luolujin.Service.LljProposeService;
import com.guigu.www.mapper.ProposeMapper;
import com.guigu.www.pojo.PageVo;
import com.guigu.www.pojo.Propose;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 作者 罗露金
 */
@Service
public class LljProposeServiceImpl implements LljProposeService {
    @Autowired
    ProposeMapper mapper;
    @Override
    public PageVo<Propose> pagePropose(Integer pageNum, Integer pageSize, String propoTitle) {
        QueryWrapper<Propose> wrapper = new QueryWrapper<>();
        wrapper.like("propo_title",propoTitle);
        Page page = new Page(pageNum, pageSize);
        IPage iPage = mapper.selectPage(page, wrapper);
        PageVo<Propose> PageVo = new PageVo<>();
        PageVo.setRows(iPage.getRecords());
        PageVo.setTotal(iPage.getTotal());
        return PageVo;
    }

    @Override
    public void updatePropose(Propose propose) {
        mapper.updateById(propose);
    }

    @Override
    public Propose selectById(Integer propoId) {
        return mapper.selectById(propoId);
    }
}
